package com.zzt.zt_hilt

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.zzt.zt_hilt.databinding.ActivityTestV2Binding
import com.zzt.zt_hilt.entity.Student
import com.zzt.zt_hilt.entity.tools
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import com.zzt.zt_hilt.inter.TestInterface


@AndroidEntryPoint
class TestActivityV2 : AppCompatActivity() {
    companion object {
        @JvmStatic
        fun start(context: Context) {
            val starter = Intent(context, TestActivityV2::class.java)
            context.startActivity(starter)
        }
    }

    val TAG = "Hilt TestActivityV2"


    @Inject
    lateinit var student2: Student

    @Inject
    lateinit var student3: Student

    @Inject
    lateinit var tools2: tools

    @Inject
    lateinit var tools3: tools

    @Inject
    lateinit var testInterface: TestInterface

    lateinit var binding: ActivityTestV2Binding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityTestV2Binding.inflate(layoutInflater)
        setContentView(binding.root)


        Log.e(TAG, "tools2：" + tools2.hashCode());
        Log.e(TAG, "tools3：" + tools3.hashCode());

        Log.e(TAG, "student2：" + student2.hashCode());
        Log.e(TAG, "student3：" + student3.hashCode());

        testInterface.method();
        initView()
    }

    private fun initView() {
        binding.btnStartV3.setOnClickListener {
            TestActivityV3.start(this@TestActivityV2)
        }
    }

}